extends Node2D
@onready var role: Node2D = $"."
@onready var character_body_2d: CharacterBody2D = $CharacterBody2D
@onready var animated_sprite_2d: AnimatedSprite2D = $CharacterBody2D/AnimatedSprite2D
@onready var label: Label = $GridContainer/Label
@onready var label_2: Label = $GridContainer/Label2
@onready var grid_container: GridContainer = $GridContainer
var max_height = 0 

func setImage(path: String, name: String,role_name: String,is_loop: bool) -> void:
	var sprite_frames = load(path)
	animated_sprite_2d.sprite_frames = sprite_frames
	animated_sprite_2d.sprite_frames.set_animation_loop(name,is_loop)
	animated_sprite_2d.play(name)
	label.text="河北新区一员"
	var my_image = animated_sprite_2d.sprite_frames.get_frame_texture(name, 0).get_image()
	if max_height <my_image.get_height()/2:
		max_height = my_image.get_height()/2
	grid_container.position.y=max_height
	label_2.text=role_name
	label.add_theme_color_override("font_color", ColorUtil.Color_45)
	label_2.add_theme_color_override("font_color", ColorUtil.Color_33)
